﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作者详情</title>
    <script src="/static/jquery-3.3.1.min.js"></script>
    <style type="text/css">
        body {
            background: white;
            font: 14px Arial, 'Microsoft YaHei';
            margin: 0px;
            padding: 0px;
        }

        #content {
            width: 1200px;
            margin-left: auto;
            margin-right: auto;

        }

        #header {
            height: 50px;
            display: flex;
        }

        #header_title {
            line-height: 0;
            margin-left: 20px;

        }

        #header_label1 {
            margin-top: 30px;
            margin-left: 250px;
        }

        #header_label1 a {
            color: black;
            text-decoration: none;
        }

        #header_label1 a:hover {
            color: red;
            text-decoration: none;
        }

        #header_label2 {
            margin-top: 30px;
            margin-left: 50px;
        }

        #header_label2 a {
            color: black;
            text-decoration: none;
        }

        #header_label2 a:hover {
            color: red;
            text-decoration: none;
        }

        .btns {
            margin-top: 23px;
            width: 80px;
            height: 40px;
            border-radius: 5px;
            background: url("../static/image/p2_hui.jpg") no-repeat left top;
            color: #FFF;
        }

        #in1 {
            margin-top: 23px;
            margin-left: 150px;
            width: 300px;
            height: 25px;
            border: 1px solid #ccc;
            padding: 7px;
            border-radius: 3px;
            padding-left: 5px;
            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
            -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
            -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
            transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
        }

        #in1:focus {
            border-color: #66afe9;
            outline: 0;
            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
        }

        #menu {
            margin-top: 24px;
            margin-left: 20px;
            width: 1160px;
            height: 45px;
            background: black;
        }

        #menu_ul li {
            line-height: 45px;
            text-align: center;
            width: 222px;
            height: 45px;
            list-style: none;
            color: white;
            border-right: 1px dashed white;
            float: left;
        }

        #menu_pc {
            float: left;
        }

        #menu_ul {
            margin-top: 0px;
            font-size: 20px;
        }

        #author {
            margin-left: 20px;
            width: 1160px;
            height: 230px;
            background-image: url("../static/image/timg_hui.jpg");

        }

        {#圆形头像框#}
        .round_icon {
            width: 130px;
            height: 130px;
            display: flex;
            border-radius: 50%;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        {#头像#}
        #head {
            width: 140px;
            height: 140px;
            padding-top: 30px;
            float: left;
        {#background-color: #888888;#}
            margin-left: 30px;
        }

        #author_name {

            width: auto;
            padding-top: 40px;
            padding-left: 190px;
        {#background-color: #337AB7;#}
        }

        #message {
            width: 60em;
            height: 4em;
            padding-left: 20px;
            float: left;
        {#background-color:red;#}
        }

        {#个人主页#}
        #personal {
            float: right;
            width: 100px;
            height: 25px;
            margin-top: 30px;
            margin-right: 10px;
            border-radius: 20px;
            background: cornsilk;
            text-align: center;
            font-size: large;

        }

        #personal a {
            text-decoration: none;
            font-size: 20px;

        }

        #last_right {
            float: right;
            margin-top: 50px;
            margin-right: 100px;

        }

        #last_right .btn {
            width: 90px;
            height: 25px;
            font-size: 18px;
            border-radius: 20px; /*控制圆角*/
            background-color: crimson;

        }
        #last_right input {
            color: #fdfff4;
        }

        #fensishu{
            margin-right: 20px;
        }
        #last {
            float: left;
            padding-left: 20px;
            padding-top: 50px;
            background-color: ;
        }

        #contents {
            width: 1160px;
            height: 500px;
            margin-left: 20px;

        }

        h1 {
            width: 800px;

        }

        .hr1 {
            width: 770px;
        }

        #left {

            float: left;
            width: 800px;
            height: auto;
            {#background-color: red;#}
        }

        .book {
            width: 100px;
            height: 25px;
            background-color: crimson;
            font-size: small;
            color: white;

        }

        .a1 {
            margin-top: 30px;
        }

        .a11 {
            width: 650px;
            height: 50px;
            float: right
        }

        .a11 h2 {
            margin-left: 20px;
            margin-top: 10px;
            color: black;
        }

        .a11 p {
            margin-left: 20px;
        }

        .a11 input {
            margin-top: 20px;
            margin-left: 20px;
            font-size: 15px;
        }

        #right {
            float: right;
            width: 350px;
        }

        .hr2 {
        }

        .a2 {
            margin-top: 30px;
            width: auto;
            {#background-color: red;#}
        }

        .a22 {
            width: 200px;
            float: right;
            margin-top: 20px;
            {#margin-right: 50px;#}
            background-color:white;
        }

        .a22 a {
            text-decoration: none;
            color: black;
        }

        .a22 p {
            margin-left: 20px;
             height: auto;
        }

        .author {
            display: -webkit-flex;
            display: flex;
            flex-direction: row;
            margin-left: 20px;

        }

        .dian {
            width: 25px;
            height: 15px;
        }

        #disappare {
            border: 3px solid #ccc;
            border-radius: 5px;
            background: #fff;
            font-size: 20px;
            width: 300px;
            height: 60px;
            position: absolute;
            z-index: 9999;
            top: 50%;
            left: 50%;
            margin: -125px 0 0 -150px;
            text-align: center;
        }

        #disappare p {
            padding: 5px;
            font-size: 16px;
            color: red;
            text-align: center;
        }
        #nocase{
            margin-top: 160px;
            margin-left: 260px;
        }
        #note span{
            font-size: large;
            margin-left: 25px;
            color: #e0dcff;
        }

    </style>
</head>
<body>
<div id="content">
    <div id="disappare" style="display: none;">
        <p>请先登录！！！</p>
    </div>
    <header>
        <iframe src="/Header/" width="1200px" FrameBorder="0" height="135px"></iframe>
    </header>

    <div id="author">
        <div id="head"><img src="{{ author.user_image }}" class="round_icon" alt=""></div>
        <div id="author_name"><h3>{{ author.user_name }}</h3></div>
        <div id="message"><p>{{ author.user_introduction }}</p></div>
        <div id="personal"><a href="/self/">个人主页</a></div>
        <div id="last"><span>作品总数：<span style="font-size:2em">{{ num }}</span>&nbsp;&nbsp;<span>本</span></span>&nbsp;&nbsp;&nbsp;&nbsp;<span>累计字数：<span
                style="font-size: 2em">{{ author.book_words }}</span><span>&nbsp;&nbsp;</span>字</span>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <div id="last_right">
            <span>关注：<span style="font-size: 2em" id="guanzhushu">{{ guanzhushu }}</span></span>&nbsp;&nbsp;
            <span>粉丝：<span style="font-size: 2em" id="fensishu">{{ fensishu }}</span></span>
            {% if guanzhu  == 'False' %}
                <input type="button" id="{{ author.user_id }}" name="button" class="btn" value="关注">
            {% else %}
                <input type="button" id="{{ author.user_id }}" name="button" class="btn" value="取消关注">
            {% endif %}
        </div>
    </div>
    <div id="contents">
        <div id="left">
            <h1>收藏书单</h1>
            <div class="hr1">
                <hr/>
            </div>
            {% if caselist %}
            {% for row in caselist %}
                <div class="a1">
                    <a href="/Details/?book_id={{ row.book_id }}"><img src="{{ row.book_image }}"></a>
                    <div class="a11">
                        <a href="/Details/?book_id={{ row.book_id }}" style="text-decoration: none">
                            <h2>{{ row.book_name }}</h2></a>
                        <p>{{ row.kind_name }}&nbsp;&nbsp;{{ row.book_state }}&nbsp;&nbsp;{{ row.book_words }}字</p>
                        <p>{{ row.book_introduction }}</p>
                        <a href="/Details/?book_id={{ row.book_id }}"><input type="button" value="书籍详情"
                                                                             class="book"></a>
                        <div class="hr2" style="background-color:#dddddd;margin-top: 20px;width: 600px"><hr/></div>
                    </div>
                </div>
            {% endfor %}
            {% else %}
                <div id="nocase">
                <div><img src="/static/image/nonebook2.png"></div>
                <div id="note"><span>暂无收藏记录！！</span></div>
                </div>
             {% endif %}

        </div>
        <div id="right">
            <h1>作品</h1>
            <div class="hr2">
                <hr/>
            </div>

            {% if author_long %}
                {% for row in author_long %}
                    <div class="a2">
                        <a href="/Details/?book_id={{ row.book_id }}"><img style="width: 150px;height: 200px"
                                                                           src="{{ row.book_image }}"></a>
                        <div class="a22">
                            <a href="/Details/?book_id={{ row.book_id }}"><p>{{ row.book_name }}</p></a>
                            <div class="author">
                                <div class="dian"><img src="../static/image/dian_hui.png"></div>
                                <div id="a22name">{{ row.user_name }}</div>
                            </div>
                        </div>
                    </div>
                {% endfor %}

            {% else %}
                {% for row in authorlist %}
                    <div class="a2">
                        <a href="/Details/?book_id={{ row.book_id }}"><img style="width: 150px;height: 200px"
                                                                           src="{{ row.book_image }}"></a>
                        <div class="a22">
                            <a href="/Details/?book_id={{ row.book_id }}"><p>{{ row.book_name }}</p></a>
                            <div class="author">
                                <div class="dian"><img src="../static/image/dian_hui.png"></div>
                                <div id="a22name">{{ row.user_name }}</div>
                            </div>
                        </div>
                    </div>
                {% endfor %}
            {% endif %}


        </div>


    </div>
</div>

</body>
<script>
    $(".btn").click(function () {
        var a = $(this).attr('value')
        if (a == '关注') {
            $.ajax
            ({
                url: '/guanzhu/',
                type: 'POST',
                data: {'userid': $(this).attr("id"), 'caozuo': 'guanzhu'},
                dataType: "JSON",
                success: function (data) {
                    if (data['title']) {
                        $("#disappare").show().delay(3000).hide(300);
                    }
                    else {
                        $("#disappare").html("");
                        var show = '';
                        show += '<p>' + data['zhuangtai'] + '</p>';
                        $("#disappare").html(show);
                        $("#guanzhushu").html(data['guanzhushu']);
                        $("#fensishu").html(data['fensishu']);
                        $("#disappare").show().delay(3000).hide(300);
                        $(".btn").attr('value',"取消关注")
                    }
                }
            })
        }
        else if (a == '取消关注') {
            $.ajax
            ({
                url: '/guanzhu/',
                type: 'POST',
                data: {userid: $(this).attr("id"), caozuo: 'quguan'},
                dataType: "JSON",
                success: function (data) {
                    if (data['title']) {
                        $("#disappare").show().delay(3000).hide(300);
                    }
                    else {
                         $("#disappare").html("");
                        var show = '';
                        show += '<p>' + data['zhuangtai'] + '</p>';
                        $("#disappare").html(show);
                        $("#guanzhushu").html(data['guanzhushu']);
                        $("#fensishu").html(data['fensishu']);
                        $("#disappare").show().delay(3000).hide(300);
	        $(".btn").attr('value',"关注")
                    }
                }
            })
        }
    })
</script>
</html>